﻿namespace UnityEditor
{
    using System;
    using UnityEditorInternal;
    using UnityEngine;

    internal class AboutWindow : EditorWindow
    {
        private bool m_ShowDetailedVersion;
        private float m_TextYPos = 120f;
        private static GUIContent s_AgeiaLogo;
        private static GUIContent s_Header;
        private static GUIContent s_MonoLogo;
        private static GUIContent s_UnityLogo;

        private static void LoadLogos()
        {
            if (s_MonoLogo == null)
            {
                s_MonoLogo = EditorGUIUtility.IconContent("MonoLogo");
                s_AgeiaLogo = EditorGUIUtility.IconContent("AgeiaLogo");
                s_UnityLogo = EditorGUIUtility.IconContent("UnityLogo");
                s_Header = EditorGUIUtility.IconContent("AboutWindow.MainHeader");
            }
        }

        public void OnGUI()
        {
            if (Event.current.type != EventType.ValidateCommand)
            {
                LoadLogos();
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Space(5f);
                GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
                GUILayout.Label(s_UnityLogo, GUIStyle.none, options);
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                GUILayout.Label(s_Header, GUIStyle.none, new GUILayoutOption[0]);
                this.m_ShowDetailedVersion |= Event.current.alt;
                if (this.m_ShowDetailedVersion)
                {
                    int unityVersionDate = InternalEditorUtility.GetUnityVersionDate();
                    DateTime time = new DateTime(0x7b2, 1, 1, 0, 0, 0, 0);
                    string unityBuildBranchUrl = InternalEditorUtility.GetUnityBuildBranchUrl();
                    string str2 = string.Empty;
                    if (unityBuildBranchUrl.Length > 0)
                    {
                        str2 = "Branch: " + unityBuildBranchUrl;
                    }
                    string[] textArray1 = new string[] { "Version ", InternalEditorUtility.GetFullUnityVersion(), "\n", string.Format("{0:r}", time.AddSeconds((double) unityVersionDate)), "\n", str2 };
                    GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.Width(400f), GUILayout.Height(40f) };
                    EditorGUILayout.SelectableLabel(string.Concat(textArray1), optionArray2);
                }
                else
                {
                    GUILayout.Label("Version " + Application.unityVersion, new GUILayoutOption[0]);
                }
                GUILayout.Space(8f);
                GUILayout.EndVertical();
                GUILayout.EndHorizontal();
                GUILayout.FlexibleSpace();
                GUI.BeginGroup(GUILayoutUtility.GetRect((float) 10f, (float) 120f));
                GUI.Label(new Rect(5f, this.m_TextYPos, base.position.width - 10f, 690f), "Adam Buckner, Adam Gutterman, Agnieszka Loza, Akouvi Ahoomey, Aleksandr Dubinskiy, Alex McCredie, Alexandra Mariner, Alexey Orlov, Alexy Abramychev, Allen Foo, Amir Ebrahimi, Andreas Hansen, Andreia Gaita, Andrius Keidonas, Andrius Kuznecovas, Andy Stark, Andy Brammall, Antti Takala, Aras PranckeviĊius, Artiom Koshelev, Aurimas Gasiulis, Aurore Dimopoulos, Aya Yoshizaki, Bas Smit, Beau Folsom, Ben Pitt, Ben Stoneman, Benjamin Quorning, Bj\x00f8rn G\x00f6ttler, Bo S. Mortensen, Bobby Billingsley, Brian E. Wilson, Brett Bibby, Brett Seyler, Caitlyn Meeks-Ferragallo, Carl Callewaert, Cat Burton, Cathy Yates, Cecilie Mosfeldt, Charles Hinshaw, Charlotte Larsen, Chida Chaemchaeng, Chris Migleo, Christian Bell Bastlund, Christopher Pope, Claude Comeau, Corey Johnson, Dan Adams, Dana Ramnarine, Daniel Collin, Dave Shorter, Davey Jackson, David Helgason, David Llewelyn, David Oh, Denis Simuntis,Dmitry Shtainer, Dustin Lee, Edward Epstein, Edward Yablonsky, Ekaterina Kalygina, Elena Savinova, Elizabeth Rankich, Ellen Liew, Elliot Solomon, Elvis Alistar, Emil Johansen, Emily Emanuel,Erik Hemming, Erik Juhl, Erin Baker, Erland K\x00f6rner, Esben Ask Meincke, Ethan Vosburgh, Fini Faria Alring, Frank Jonsson, Fredrik von Renteln, Freyr Helgason, Gabriele Farina, Graham Dunnett, Hanna Yi, Heidi Therkildsen, Heine Meineche Fusager, Henrik Nielsen, Hiroki Omae, Holmfriour Gunnarsdottir, HoMin Lee, Hugh Longworth, Hyunjai Shin, Ian Dunlap, Ignas Ziberkas, Ilya Tursatov, Isabelle Jacquinot, Jakob Hunsballe, Jakub \"Kuba\" Cupisz, James Bouckley, Jan Marguc, Jason Parks, Jay Clei Garcia dos Santos, Jed Ritchey, Jeff Kirkley, Jeff Aydelotte, Jessica Qian, Justin Kruger, Jens Fursund, Jens Andersen, Jesper Mortensen, Jessika Jackson, Jiwon Yu, Jonathan Chambers, Joachim Ante, JoAnna Matthisen, Joe Robins, Joe Santos, Joen Joensen, Jonas Echterhoff, Jonas Christian Drewsen, Jonas Meyer, Jookyung Hyun, Joseph Walters, Joyce Juezhang, Juan Sebastian Mu\x00f1oz, Juha Kiili, Jukka Arvo, Julius MikneviĊius, Jussi Venho, Justinas Vygintas Daugmaudis Kamio Chambless, Karen Riskaer Joergensen, Karsten Nielsen, Kaspar Daugaard, Kasper Amstrup Andersen, Katherine Overmeyer, Katrine Hegnsborg Bruun, Keijiro Takahashi, Keli Hl\x00f6\x00f0versson, Kelly Sandvig, Ken Noland, Kevin Ashman, Kevin Robertson, Kiersten Petesch, Kimi Wang, Kim Steen Riber, Kimberly Bailey, Kimberly Verde, Kjartan Olafsson, Kornel Mikes, Kristian Mandrup, Leonardo Carneiro, Levi Bard, Lars \"Kroll\" Kristensen, Lars M\x00f8lg\x00e5rd Nielsen, Lasse J\x00e4rvensivu, Lasse Makholm, L\x00e1rus \x00d3lafsson, Lucas Meijer, Loreta BalĊiūnaitė, Louise Skaarup, Madelaine Fouts, Mads Kjellerup, Mads Nyholm, Maj-Brit Jo Arnested, Makoto Itoh, Mantas Puida, Marc-Antoine Vallee, Marek Turski, Marina \x00d8ster, Mark Harkness, Mark T. Morrison, Martin Eberhardt, Martin Nielsen, Martin Sternevald, Martin Stjernholk Vium, Massimiliano Mantione, Massimo Caterino, Matt Reynolds, Matthew Fini, Marvin Kharrazi, Michael Krarup Nielsen, Mircea Marghidanu, Mikkel \"Frecle\" Fredborg, Monika Madrid, Morten Sommer, Na'Tosha Bard, Nevin Eronde, Ngozi Watts, Nicholas Francis, Nick Jovic, Nicolaj Schweitz, Ole Ciliox,Oleg Pridiuk, Olly Nicholson, Oren Tversky, Patrick Williamson, Paulius Liekis, Pernille Hansen, Peter Ejby Dahl Jensen, Petri Nordlund, Pierre Paul Giroux, Ralph Hauwert, Randy Spong, Rasmus \"Razu\" Boserup, Renaldas \"ReJ\" Zioma, Ren\x00e9 Damm, Rickard Andersson, Ricardo Arango, Richard Sykes, Rita Turkowski, Roald H\x00f8yer-Hansen, Rob Fairchild, Robert Cupisz, Robert Lanciault, Rodrigo B. de Oliveira, Rune Skovbo Johansen, Ruslan Grigoryev, Russ Morris, Rytis Bieliūnas, Sakari Pitk\x00e4nen, Samantha Kalman, Sara Cannon, Sergej Kravcenko, Sean Baggaley, Silviu Ionescu, Shanti Zachariah, Shawn White, Shinobu Toyoda, Skjalm Arr\x00f8e, Sonny Myette, Susan Anderson, Steen Lund, Steffen Toksvig, Sten Selander, S\x00f8ren Christiansen, Tec Liu, Terry Hendrix II, Thomas Golzen, Thomas Grov\x00e9, Thomas Hagen Johansen, Thomas Harkj\x00e6r Petersen, Thomas Kristiansen, Thomas Svaerke, Timothy Cooper, Todd Rutherford, Tom Higgins, Tomas Dirvanauskas, Tomas Jakubauskas, Tony Garcia, Torben Jeppesen, Tracy Erickson, Tricia Gray, Valdemar BuĊilko, Vibe Herlitschek, Victor Suhak, Vilmantas BalaseviĊius, Vladimir Gerastovsky, Vytautas Šaltenis, Xin Zhang, Wayne Johnson, Will Goldstone, William Hugo Yang, William Nilsson, Yelena Rubinshteyn, Yohei Tanaka, Yunkyu Choi, Zachary Zadell, Zbignev MonkeviĊ, Zhenping Guo", EditorStyles.wordWrappedLabel);
                GUI.Label(new Rect(5f, this.m_TextYPos + 690f, base.position.width - 10f, 720f), "Thanks to Forest 'Yoggy' Johnson, Graham McAllister, David Janik-Jones, Raimund Schumacher, Alan J. Dickins and Emil 'Humus' Persson", EditorStyles.wordWrappedMiniLabel);
                GUI.EndGroup();
                GUILayout.FlexibleSpace();
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Label(s_MonoLogo, new GUILayoutOption[0]);
                GUILayoutOption[] optionArray3 = new GUILayoutOption[] { GUILayout.Width(200f) };
                GUILayout.Label("Scripting powered by The Mono Project.\n\n(c) 2011 Novell, Inc.", "MiniLabel", optionArray3);
                GUILayout.Label(s_AgeiaLogo, new GUILayoutOption[0]);
                GUILayoutOption[] optionArray4 = new GUILayoutOption[] { GUILayout.Width(200f) };
                GUILayout.Label("Physics powered by PhysX.\n\n(c) 2011 NVIDIA Corporation.", "MiniLabel", optionArray4);
                GUILayout.EndHorizontal();
                GUILayout.FlexibleSpace();
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Space(5f);
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                GUILayout.Label("\n" + InternalEditorUtility.GetUnityCopyright(), "MiniLabel", new GUILayoutOption[0]);
                GUILayout.EndVertical();
                GUILayout.Space(10f);
                GUILayout.FlexibleSpace();
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                GUILayout.Label(InternalEditorUtility.GetLicenseInfo(), "AboutWindowLicenseLabel", new GUILayoutOption[0]);
                GUILayout.EndVertical();
                GUILayout.Space(5f);
                GUILayout.EndHorizontal();
                GUILayout.Space(5f);
            }
        }

        public void OnInspectorUpdate()
        {
            this.m_TextYPos--;
            if (this.m_TextYPos < -720f)
            {
                this.m_TextYPos = 120f;
            }
            base.Repaint();
        }

        private static void ShowAboutWindow()
        {
            AboutWindow window = EditorWindow.GetWindowWithRect<AboutWindow>(new Rect(100f, 100f, 570f, 340f), true, "About Unity");
            window.position = new Rect(100f, 100f, 570f, 340f);
            window.m_Parent.window.m_DontSaveToLayout = true;
        }
    }
}

